<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>查看调整记录</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
    <style type="text/css">
    	.detail{
    		padding-right: 20px!important;
    	}
    	h5{color: #0062CC;}
	</style>
</head>

<body>
	<div class="mui-content">
		<ul class="mui-table-view mui-table-view-chevron" id="stockDetailContent">
			<script type="text/template" id="items">
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">SGMW ID：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5">{{datas.itemnum}}</span>
	                </div>
	            </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">仓库：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5">{{datas.location}}</span>
	                </div>
	            </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">库存地址：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5">{{datas.binnum}}</span>
	                </div>
	            </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">描述：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5">{{datas.description}}</span>
	                </div>
	            </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">规格：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5">{{datas.cSpcifications}}</span>
	                </div>
	            </div>
			</li>
			</script>
		</ul>
		<div class="mui-segmented-control mui-segmented-control-inverted mui-segmented-control-primary segmentedControl type_list_spair">
			<a class="mui-control-item mui-active" tapmode onclick="ChMonth(1)">近一个月</a>
			<a class="mui-control-item" tapmode onclick="ChMonth(12)">近一年</a>
			<a class="mui-control-item" tapmode onclick="ChMonth('')">全部</a>
		</div>
		<div class="mui-content" id="LocationContent">
			<script type="text/template" id="itemslist">
				{{each datas as item i}}
			<div class="mui-card">
				<ul class="mui-table-view mui-table-view-chevron">
					<li class="mui-table-view-cell mui-collapse">
						<a class="mui-navigate-right" href="#">交易类型：{{item.transtype}}
							<span class="mui-badge mui-badge-inverted">{{item.transdate2}}</span>
						</a>
						<ul class="mui-table-view mui-table-view-chevron">
              {{if item.transtype == '标准成本调整'}}
                <li class="mui-table-view-cell">调整前价格：{{item.oldcost}}</li>
                <li class="mui-table-view-cell">调整后价格：{{item.newcost}}</li>
                <li class="mui-table-view-cell">录入人：{{item.enterbyName}}</li>
                <li class="mui-table-view-cell">旧库存地址：{{item.binnum}}</li>
              {{else if item.transtype == '当前余量调整'}}
                <li class="mui-table-view-cell">调整前余量：{{item.physcnt}}</li>
                <li class="mui-table-view-cell">调整后余量：{{item.curbal}}</li>
  							<li class="mui-table-view-cell">录入人：{{item.enterbyName}}</li>
                <li class="mui-table-view-cell">旧库存地址：{{item.binnum}}</li>
              {{/if}}
						</ul>
					</li>
				</ul>
			</div>
			{{/each}}
				</script>
		</div>
	</div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/template.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
  	var page = 1;
		var loadEnd = false;
		var LocationId = '', locationName = '', Location= '', chmonths= '1';
		apiready = function () {
			onLoadData(page,false);
			scrollToBottomHandler(function() {
				if (!loadEnd) { // 没有结束时继续加载
					page++;
					onLoadData(page,true);
				} else { // 告诉到底了
					EndToast('到底了');
				}
			})
			Refresh(function() {
				loadEnd = false;
				page = 1;
				onLoadData(page,false);
			});

			api.addEventListener({
		    name:'navitembtn'
			},function(ret, err){
			    if(ret.type == 'right'){
			    	if($api.dom("input[type='radio']:checked") == null){
			    		api.toast({
							    msg: '请选择一项!',
							    duration: 2000,
							    location: 'middle'
							});
			    		return
			    	} else{
			    		api.sendEvent({
						    name: 'LocactionId',
						    extra: {
						        locationid: LocationId,
						        locationName: locationName,
						        Location: Location
						    }
							});
				    	setTimeout(function(){
				    		api.closeWin();
				    	},100)
			    	}
			    }
		  })
		}
		function onLoadData (page,load) {
			ajaxrd('queryMarginList', {
				timeId: chmonths,
				itemnum: api.pageParam.itemnum,
				location: api.pageParam.location,
				pageNo: page,
				pageSize: 10
			}, function(ret, err) {
				api.refreshHeaderLoadDone();
				AddData('itemslist','LocationContent', ret.list, load);
				if (ret.list.length < 10) {
					loadEnd = true
				}
			})
			ajaxrd("queryItemDetail", {
				inventoryid: api.pageParam.inventoryid || '',
				itemnum: api.pageParam.itemnum || '',
				binnum: api.pageParam.binnum ||''
			}, function(ret, err) {
				AddData('items','stockDetailContent',ret, false);
			})
		}
		var ChMonth = function (id) {
			chmonths = id
			loadEnd = false;
				page = 1;
				onLoadData(page,false);
		}
</script>

</html>
